package com.du.mybatis.dao;

import com.du.mybatis.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author : DuJiabao
 * @Date : 2021/3/5 23:03
 * @Project : MyBatis
 * @File : null.java
 * @Desc :
 */
public interface UserMapper {
  @Select("select * from user")
  List<User> selectUsers();

  @Select("select * from user limit #{startIndex}, #{offset}")
  List<User> selectUsersByLimit(@Param("startIndex") int startIndex, @Param("offset") int offset);

  @Insert("insert into user(name, address) values(#{name}, #{address})")
  int insertUser(User user);

  @Delete("delete from user where id = #{id}")
  int deleteUserById(@Param("id") int id);

  @Update("update user set name=#{name}, address=#{address} where id=#{id}")
  int updateUser(User user);
}
